<?php echo $header; ?>
<style id="iframeStyle">
    .hover {
        box-shadow: 0 0 2px 2px #F30 !important;
        -moz-box-shadow: 0 0 2px 2px #F30 !important;
        -webkit-box-shadow: 0 0 2px 2px #F30 !important;
    }
    .editting {
        box-shadow: 0 0 2px 2px #F30 !important;
        -moz-box-shadow: 0 0 2px 2px #F30 !important;
        -webkit-box-shadow: 0 0 2px 2px #F30 !important;
    }
</style>
<div id="content" class="kuler-module">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading clearafter">
      <h1><img src="./view/kulercore/images/logos/kuler_cp.png" alt="<?php echo $heading_title; ?>" /></h1>
      <div class="buttons">
          <a onclick="$('#form').submit();" class="button save-settings"><?php echo $button_save; ?></a>
          <a onclick="$('#op').val('close'); $('#form').submit();" class="button cancel-settings"><?php echo $button_close; ?></a>
          <a href="<?php echo $cancel; ?>" class="button cancel-settings"><?php echo $button_cancel; ?></a>
      </div>
    </div>
	<div class="content">
		<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form" class="clearafter">
            <input type="hidden" name="vtab" id="vtab" value="<?php echo $vtab ?>" />
            <input type="hidden" name="htab" id="htab" value="<?php echo $htab ?>" />
            <input type="hidden" name="op" id="op" />

            <div style="margin: 20px 0 0 30px;">
                <label><?php echo $__['entry_store']; ?></label>
                <select name="store_id" id="StoreSelector">
                    <?php foreach ($stores as $store_id => $store_name) { ?>
                        <option value="<?php echo $store_id; ?>"<?php if ($store_id == $selected_store_id) echo ' selected="selected"'; ?>><?php echo $store_name; ?></option>
                    <?php } ?>
                </select>
            </div>

            <!-- tab: Header -->
            <ul class="vtabs">
                <li><a href="#tab-module-general" class="module-global"><?php echo $__['text_general']; ?></a></li>
                <li><a href="#tab-module-seo" class="module-seo"><?php echo $__['text_seo']; ?></a></li>
                <li><a href="#tab-module-footer" class="module-footer"><?php echo $__['text_bottom']; ?></a></li>
                <li><a href="#tab-module-compression" class="module-compression"><?php echo $__['text_compression']; ?></a></li>
            </ul>
            <!-- tab: General -->
			<div id="tab-module-general" class="vtabs-content clearafter">
                <table class="form">
                    <tr>
                        <td><?php echo $entry_color_scheme ?></td>
                        <td>
                            <select name="color[status]">
                                <?php foreach($colors as $name => $title) { ?>
                                <option value="<?php echo $name ?>"<?php echo isset($color['status']) && $color['status'] == $name ? ' selected="selected"' : '' ?>><?php echo $title ?></option>
                                <?php } ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo $entry_font_google_heading ?></td>
                        <td width="10">
                            <div class="kuler-switch-btn">
                                <input type='hidden' name='font[heading][status]' value='0' />
                                <input type="checkbox" name="font[heading][status]"<?php echo isset($font['heading']['status']) && $font['heading']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                <span class="kuler-switch-btn-holder"></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo $entry_font_google_body ?></td>
                        <td width="10">
                            <div class="kuler-switch-btn">
                                <input type='hidden' name='font[body][status]' value='0' />
                                <input type="checkbox" name="font[body][status]"<?php echo isset($font['body']['status']) && $font['body']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                <span class="kuler-switch-btn-holder"></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo $entry_font_heading ?></td>
                        <td>
                            <select name="font[heading][font-index]">
                                <?php foreach($fonts as $k => $item) { ?>
                                <option value="<?php echo $k ?>"<?php echo isset($font['heading']['font-index']) && $font['heading']['font-index'] == $k ? ' selected="selected"' : '' ?>><?php echo $item['font-name'] ?></option>
                                <?php } ?>
                            </select>
                            <input type="text" name="font[heading][font-weight]" value="<?php echo isset($font['heading']['font-weight']) ? $font['heading']['font-weight'] : '400,600,700' ?>" size="20" placeholder="400,600,700" />
                            <a onclick="return fontUpdate();" class="button">Update lastest Fonts</a>
                            <?php if(isset($error_font_heading_weight)) { ?>
                            <span class="error"><?php echo $error_font_heading_weight; ?></span>
                            <?php } ?>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo $entry_font_body ?></td>
                        <td>
                            <select name="font[body][font-index]">
                                <?php foreach($fonts as $k => $item) { ?>
                                <option value="<?php echo $k ?>"<?php echo isset($font['body']['font-index']) && $font['body']['font-index'] == $k ? ' selected="selected"' : '' ?>><?php echo $item['font-name'] ?></option>
                                <?php } ?>
                            </select>
                            <input type="text" name="font[body][font-weight]" value="<?php echo isset($font['body']['font-weight']) ? $font['body']['font-weight'] : '400,600,700' ?>" size="20" placeholder="400,600,700" />
                            <a onclick="return fontUpdate();" class="button">Update lastest Fonts</a>
                            <?php if(isset($error_font_body_weight)) { ?>
                            <span class="error"><?php echo $error_font_body_weight; ?></span>
                            <?php } ?>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo $entry_copyright_custom ?></td>
                        <td width="10">
                            <div class="kuler-switch-btn">
                                <input type='hidden' name='block[copyright][status]' value='0' />
                                <input type="checkbox" name="block[copyright][status]"<?php echo isset($block['copyright']['status']) && $block['copyright']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                <span class="kuler-switch-btn-holder"></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo $entry_copyright_content ?></td>
                        <td><textarea class="editor" name="block[copyright][content]" cols="58" rows="10"><?php echo isset($block['copyright']['content']) ? $block['copyright']['content'] : '' ?></textarea></td>
                    </tr>
                </table>					
            </div>
            <!-- tab: SEO -->
            <div id="tab-module-seo" class="vtabs-content clearafter">
                <div id="tab-seo" class="htabs kulerhtabs">
                    <a href="#tab-sitemap-generator" class="selected">Sitemap Generator</a>
                    <a href="#tab-google-analytics" class="selected">Google Analytics</a>
                </div>
                <!-- tab: Sitemap Generator -->
                <div id="tab-sitemap-generator">
                    <!-- group: Sitemap generator -->
                    <table id="form-sitemap-generator" class="form">
                        <tr>
                            <td><?php echo $entry_sitemap_file ?></td>
                            <td>
                                <select id="SiteMapType" name="seo[sitemap_filetype]">
                                    <option value="xml"<?php echo isset($seo['sitemap_filetype']) && $seo['sitemap_filetype'] == 'xml' ? ' selected="selected"' : '' ?>><?php echo $text_xml_file ?></option>
                                    <option value="gzip"<?php echo isset($seo['sitemap_filetype']) && $seo['sitemap_filetype'] == 'gzip' ? ' selected="selected"' : '' ?>><?php echo $text_gzip_file ?></option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_sitemap_notify_se ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='seo[sitemap_notify]' value='0' />
                                    <input type="checkbox" name="seo[sitemap_notify]"<?php echo isset($seo['sitemap_notify']) && $seo['sitemap_notify'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_sitemap_robots ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='seo[sitemap_robots]' value='0' />
                                    <input type="checkbox" name="seo[sitemap_robots]"<?php echo isset($seo['sitemap_robots']) && $seo['sitemap_robots'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_sitemap_modification ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='seo[sitemap_modification]' value='0' />
                                    <input type="checkbox" name="seo[sitemap_modification]"<?php echo isset($seo['sitemap_modification']) && $seo['sitemap_modification'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_sitemap_stylesheet ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='seo[sitemap_stylesheet]' value='0' />
                                    <input type="checkbox" name="seo[sitemap_stylesheet]"<?php echo isset($seo['sitemap_stylesheet']) && $seo['sitemap_stylesheet'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_sitemap_limit ?></td>
                            <td>
                                <input type="text" name="seo[sitemap_limit]" value="<?php echo isset($seo['sitemap_limit']) ? $seo['sitemap_limit'] : '30' ?>" placeholder="30" size="10" />
                                <?php if (isset($error_sitemap_limit)) { ?>
                                <span class="error"><?php echo $error_sitemap_limit; ?></span>
                                <?php } ?>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $text_generate_help ?></td>
                            <td>
                                <a onclick="sitemap.generate();" class="button">Generate</a>
                            </td>
                        </tr>
                    </table>
                    
                    <!-- group: Sitemap location -->
                    <div id="tab-seo-location" class="htabs kulerhtabs">
                        <a href="#tab-sitemap-location" class="selected">Location</a>
                    </div>
                    <table id="form-seo-location" class="form">
                        <tr>
                            <td rowspan="3"><?php echo $entry_sitemap_detection ?></td>
                            <td><em><?php echo $entry_sitemap_detect_filename ?></em></td>
                            <td>
                                <input type="text" id="SiteMapDetectFileName" disabled="disabled" value="<?php echo isset($seo['sitemap_detect_filename']) ? $seo['sitemap_detect_filename'] : '' ?>" size="60" />
                            </td>
                        </tr>
                        <tr>
                            <td><em><?php echo $entry_sitemap_detect_path ?></em></td>
                            <td>
                                <input type="text" disabled = "disabled" value="<?php echo isset($seo['sitemap_detect_path']) ? $seo['sitemap_detect_path'] : '' ?>" size="60" />
                            </td>
                        </tr>
                        <tr>
                            <td><em><?php echo $entry_sitemap_detect_url ?></em></td>
                            <td>
                                <input type="text" id="SiteMapDetectUrl" disabled="disabled" value="<?php echo isset($seo['sitemap_detect_url']) ? $seo['sitemap_detect_url'] : '' ?>" size="60" />
                            </td>
                        </tr>
                        <tr>
                            <td rowspan="2"><?php echo $entry_sitemap_custom_location ?></td>
                            <td><em><?php echo $entry_sitemap_path; ?></em></td>
                            <td>
                                <input type="text" id="sitemap_filename" name="seo[sitemap_filename]" value="<?php echo isset($seo['sitemap_filename']) ? $seo['sitemap_filename'] : '' ?>" placeholder="sitemap.xml" size="60" />
                                <a onclick="sitemap.generatePath();" class="button">Auto</a>
                                <?php if (isset($error_sitemap_filename)) { ?>
                                <span class="error"><?php echo $error_sitemap_filename; ?></span>
                                <?php } ?>
                            </td>
                        </tr>
                        <tr>
                            <td><em><?php echo $entry_sitemap_url ?></em></td>
                            <td>
                                <input type="text" id="SiteMapUrl" name="seo[sitemap_url]" value="<?php echo isset($seo['sitemap_url']) ? $seo['sitemap_url'] : '' ?>" placeholder="<?php echo $base ?>sitemap.xml" size="60" />
                                <a onclick="sitemap.generateUrl();" class="button">Auto</a>
                                <?php if (isset($error_sitemap_url)) { ?>
                                <span class="error"><?php echo $error_sitemap_url; ?></span>
                                <?php } ?>
                            </td>
                        </tr>
                    </table>
				</div>

                <!-- tab: Google Analytics -->
                <div id="tab-google-analytics">
                    <table class="form">
                        <tr>
                            <td><?php echo $entry_ga_status ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='seo[status]' value='0' />
                                    <input type="checkbox" name="seo[status]"<?php echo isset($seo['status']) && $seo['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_ga_position ?></td>
                            <td>
                                <select name="seo[position]">
                                    <option value="head"<?php echo isset($seo['position']) && $seo['position'] == 'head' ? ' selected="selected"' : '' ?>>Inside head tag</option>
                                    <option value="bottom"<?php echo isset($seo['position']) && $seo['position'] == 'bottom' ? ' selected="selected"' : '' ?>>At the bottom of page</option>
                                </select>
                            </td>
                        </tr>
                    </table>                    
				</div>
            </div>
            <!-- tab: Footer -->
            <div id="tab-module-footer" class="vtabs-content clearafter">
                <!-- tab: Footer Header -->
                <div id="tab-footer" class="htabs kulerhtabs">
                    <a href="#tab-footer-info" class="selected">Information</a>
                    <a href="#tab-footer-contact">Contact</a>
                    <a href="#tab-footer-twitter">Twitter</a>
                    <a href="#tab-footer-facebook">Facebook</a>
                    <a href="#tab-footer-payment">Payment Icons</a>
                </div>
                <!-- tab: Footer Information -->
                <div id="tab-footer-info">
                    <!-- block: Information settings -->
                    <div id="tab-footer-info-lang" class="htabs">
                        <?php foreach ($languages as $language) { ?>
                        <a href="#tab-tab-footer-info-lang-<?php echo $language['language_id']; ?>">
                            <img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /> <?php echo $language['name']; ?>
                        </a>
                        <?php } ?>
                    </div>
                    <table class="form">
                        <tr>
                            <td><?php echo $entry_status ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[info][status]' value='0' />
                                    <input type="checkbox" name="block[info][status]"<?php echo isset($block['info']['status']) && $block['info']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                    </table>
					<?php foreach ($languages as $language) { ?>
                    <div id="tab-tab-footer-info-lang-<?php echo $language['language_id']; ?>">
                        <table class="form">
                            <tr>
                                <td><?php echo $entry_title ?></td>
                                <td>
                                    <input type="text" name="block[info][<?php echo $language['language_id']; ?>][title]" size="56" value="<?php echo isset($block['info'][$language['language_id']]['title']) ? $block['info'][$language['language_id']]['title'] : '' ?>" placeholder="Block Title">
                                </td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_description ?></td>
                                <td>
                                    <textarea class="editor" name="block[info][<?php echo $language['language_id']; ?>][description]" cols="58" rows="10" placeholder="Block description"><?php echo isset($block['info'][$language['language_id']]['description']) ? $block['info'][$language['language_id']]['description'] : '' ?></textarea>
                                </td>
                            </tr>
                        </table>
                    </div>
					<?php } ?>							
				</div>
                <!-- tab: Footer Contact -->
                <div id="tab-footer-contact">
                    <table class="form">
                        <tr>
                            <td><?php echo $entry_status ?></td>
                            <td colspan="2">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[contact][status]' value='0' />
                                    <input type="checkbox" name="block[contact][status]"<?php echo isset($block['contact']['status']) && $block['contact']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_title; ?></td>
                            <td colspan="2">
                                <input type="text" name="block[contact][title]" value="<?php if (isset($block['contact']['title'])) echo $block['contact']['title']; ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_skype ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[contact][skype][status]' value='0' />
                                    <input type="checkbox" name="block[contact][skype][status]"<?php echo isset($block['contact']['skype']['status']) && $block['contact']['skype']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                            <td>
                                <input class="inline" type="text" name="block[contact][skype][name1]" value="<?php echo isset($block['contact']['skype']['name1']) ? $block['contact']['skype']['name1'] : '' ?>" placeholder="Primary Username">
                                <input class="inline" type="text" name="block[contact][skype][name2]" value="<?php echo isset($block['contact']['skype']['name2']) ? $block['contact']['skype']['name2'] : '' ?>" placeholder="Secondary Username">
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_mail ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[contact][email][status]' value='0' />
                                    <input type="checkbox" name="block[contact][email][status]"<?php echo isset($block['contact']['email']['status']) && $block['contact']['email']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                            <td>
                                <input class="inline" type="text" name="block[contact][email][name1]" value="<?php echo isset($block['contact']['email']['name1']) ? $block['contact']['email']['name1'] : '' ?>" placeholder="Primary Email">
                                <input class="inline" type="text" name="block[contact][email][name2]" value="<?php echo isset($block['contact']['email']['name2']) ? $block['contact']['email']['name2'] : '' ?>" placeholder="Secondary Email">
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_mobile ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[contact][mobile][status]' value='0' />
                                    <input type="checkbox" name="block[contact][mobile][status]"<?php echo isset($block['contact']['mobile']['status']) && $block['contact']['mobile']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                            <td>
                                <input class="inline" type="text" name="block[contact][mobile][name1]" value="<?php echo isset($block['contact']['mobile']['name1']) ? $block['contact']['mobile']['name1'] : '' ?>" placeholder="Primary Mobile">
                                <input class="inline" type="text" name="block[contact][mobile][name2]" value="<?php echo isset($block['contact']['mobile']['name2']) ? $block['contact']['mobile']['name2'] : '' ?>" placeholder="Secondary Mobile">
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_phone ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[contact][phone][status]' value='0' />
                                    <input type="checkbox" name="block[contact][phone][status]"<?php echo isset($block['contact']['phone']['status']) && $block['contact']['phone']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                            <td>
                                <input class="inline" type="text" name="block[contact][phone][name1]" value="<?php echo isset($block['contact']['phone']['name1']) ? $block['contact']['phone']['name1'] : '' ?>" placeholder="Primary Phone">
                                <input class="inline" type="text" name="block[contact][phone][name2]" value="<?php echo isset($block['contact']['phone']['name2']) ? $block['contact']['phone']['name2'] : '' ?>" placeholder="Secondary Phone">
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_fax ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[contact][fax][status]' value='0' />
                                    <input type="checkbox" name="block[contact][fax][status]"<?php echo isset($block['contact']['fax']['status']) && $block['contact']['fax']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                            <td>
                                <input class="inline" type="text" name="block[contact][fax][name1]" value="<?php echo isset($block['contact']['fax']['name1']) ? $block['contact']['fax']['name1'] : '' ?>" placeholder="Primary Fax">
                                <input class="inline" type="text" name="block[contact][fax][name2]" value="<?php echo isset($block['contact']['fax']['name2']) ? $block['contact']['fax']['name2'] : '' ?>" placeholder="Secondary Fax">
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- tab: Footer Twitter -->
                <div id="tab-footer-twitter">
                    <!-- block: Twitter settings -->
                    <table class="form">
                        <tr>
                            <td><?php echo $entry_status ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[twitter][status]' value='0' />
                                    <input type="checkbox" name="block[twitter][status]"<?php echo isset($block['twitter']['status']) && $block['twitter']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_title; ?></td>
                            <td colspan="2">
                                <input type="text" name="block[twitter][title]" value="<?php if (isset($block['twitter']['title'])) echo $block['twitter']['title']; ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_embed_code ?>
                            </td>
                            <td>
                                <textarea name="block[twitter][embed_code]" cols="80" rows="2"><?php if (isset($block['twitter']['embed_code'])) echo $block['twitter']['embed_code']; ?></textarea>
                                <br />
                                <span class="help"><a href="https://twitter.com/settings/widgets" target="_blank">Get Embed Timeline Code</a></span>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_theme; ?></td>
                            <td>
                                <label for="block_twitter_theme_light"><input type="radio" name="block[twitter][theme]" value="light" id="block_twitter_theme_light"<?php if (isset($block['twitter']['theme']) && $block['twitter']['theme'] == 'light') echo ' checked="checked"'; ?> /> Light</label> &nbsp;
                                <label for="block_twitter_theme_dark"><input type="radio" name="block[twitter][theme]" value="dark" id="block_twitter_theme_dark"<?php if (isset($block['twitter']['theme']) && $block['twitter']['theme'] == 'dark') echo ' checked="checked"'; ?> /> Dark</label>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_dimension; ?>
                            </td>
                            <td>
                                <input type="text" placeholder="Width" name="block[twitter][width]" value="<?php if (isset($block['twitter']['width'])) echo $block['twitter']['width']; ?>" size="5" />
                                <input type="text" placeholder="Height" name="block[twitter][height]" value="<?php if (isset($block['twitter']['height'])) echo $block['twitter']['height']; ?>" size="5" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_link_color; ?></td>
                            <td>
                                <input type="text" name="block[twitter][link_color]" value="<?php if (isset($block['twitter']['link_color'])) echo $block['twitter']['link_color']; ?>" size="10" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_background; ?></td>
                            <td>
                                <div class="kuler-switch-btn">
                                    <input type="hidden" name="block[twitter][background]" value="0" />
                                    <input type="checkbox" name="block[twitter][background]"<?php echo isset($block['twitter']['background']) && $block['twitter']['background'] ? ' checked="checked"' : '' ?>  value="1" />
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_border; ?></td>
                            <td>
                                <div class="kuler-switch-btn">
                                    <input type="hidden" name="block[twitter][border]" value="0" />
                                    <input type="checkbox" name="block[twitter][border]"<?php if (isset($block['twitter']['border']) && $block['twitter']['border']) echo ' checked="checked"'; ?>  value="1" />
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_border_color; ?></td>
                            <td>
                                <input type="text" name="block[twitter][border_color]" value="<?php if (isset($block['twitter']['border_color'])) echo $block['twitter']['border_color']; ?>" size="10" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_header; ?></td>
                            <td>
                                <div class="kuler-switch-btn">
                                    <input type="hidden" name="block[twitter][header]" value="0" />
                                    <input type="checkbox" name="block[twitter][header]"<?php echo isset($block['twitter']['header']) && $block['twitter']['header'] ? ' checked="checked"' : '' ?>  value="1" />
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_footer; ?></td>
                            <td>
                                <div class="kuler-switch-btn">
                                    <input type="hidden" name="block[twitter][footer]" value="0" />
                                    <input type="checkbox" name="block[twitter][footer]"<?php echo isset($block['twitter']['footer']) && $block['twitter']['footer'] ? ' checked="checked"' : '' ?>  value="1" />
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_twitter_scrollbar; ?></td>
                            <td>
                                <div class="kuler-switch-btn">
                                    <input type="hidden" name="block[twitter][scrollbar]" value="0" />
                                    <input type="checkbox" name="block[twitter][scrollbar]"<?php echo isset($block['twitter']['scrollbar']) && $block['twitter']['scrollbar'] ? ' checked="checked"' : '' ?>  value="1" />
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_tweet_number ?></td>
							<td>
								<select name="block[twitter][number]">
									<?php for($i=1;$i<5;$i++) : ?>
									<?php if(isset($block['twitter']['number']) && $block['twitter']['number'] == $i) : ?>
									<option value="<?php echo $i ?>" selected="selected"><?php echo $i ?></option>
									<?php else : ?>
									<option value="<?php echo $i ?>"><?php echo $i ?></option>
									<?php endif ?>
									<?php endfor ?>
                                </select>
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- tab: Footer Facebook -->
                <div id="tab-footer-facebook">
                    <!-- block: Facebook settings -->
                    <table class="form">
                        <tr>
                            <td><?php echo $entry_status ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[facebook][status]' value='0' />
                                    <input type="checkbox" name="block[facebook][status]"<?php echo isset($block['facebook']['status']) && $block['facebook']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_title; ?></td>
                            <td colspan="2">
                                <input type="text" name="block[facebook][title]" value="<?php if (isset($block['facebook']['title'])) echo $block['facebook']['title']; ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_facebook ?></td>
                            <td>
                                <input class="inline" type="text" name="block[facebook][page]" value="<?php echo isset($block['facebook']['page']) ? $block['facebook']['page'] : '' ?>" size="25" placeholder="Facebook Username" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_facebook_theme; ?></td>
                            <td>
                                <label for="block_facebook_theme_light"><input type="radio" name="block[facebook][theme]" value="light" id="block_facebook_theme_light"<?php if (isset($block['facebook']['theme']) && $block['facebook']['theme'] == 'light') echo ' checked="checked"'; ?> /> Light</label> &nbsp;
                                <label for="block_twitter_theme_dark"><input type="radio" name="block[facebook][theme]" value="dark" id="block_facebook_theme_dark"<?php if (isset($block['facebook']['theme']) && $block['facebook']['theme'] == 'dark') echo ' checked="checked"'; ?> /> Dark</label>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_width ?></td>
                            <td>
                                <input class="inline" type="text" name="block[facebook][width]" value="<?php echo isset($block['facebook']['width']) ? $block['facebook']['width'] : '235' ?>" placeholder="235" size="3" />
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_height ?></td>
                            <td>
                                <input class="inline" type="text" name="block[facebook][height]" value="<?php echo isset($block['facebook']['height']) ? $block['facebook']['height'] : '265' ?>" placeholder="265" size="3" />
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- tab: Footer Payment Icons -->
                <div id="tab-footer-payment">
                    <table class="form">
                        <tr>
                            <td><?php echo $entry_status ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[payment][status]' value='0' />
                                    <input type="checkbox" name="block[payment][status]"<?php echo isset($block['payment']['status']) && $block['payment']['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                        </tr>
                        <?php foreach($payments as $item) { ?>
                        <tr>
                            <td><?php echo $item['name'] ?></td>
                            <td width="10">
                                <div class="kuler-switch-btn">
                                    <input type='hidden' name='block[payment][items][<?php echo $item['value'] ?>][status]' value='0' />
                                    <input type="checkbox" name="block[payment][items][<?php echo $item['value'] ?>][status]"<?php echo isset($block['payment']['items'][$item['value']]['status']) && $block['payment']['items'][$item['value']]['status'] ? ' checked="checked"' : '' ?>  value="1">
                                    <span class="kuler-switch-btn-holder"></span>
                                </div>
                            </td>
                            <td class="center" width="100">
                                <div id="PaymentIconContainer_<?php echo $item['value'] ?>" style="float: left; margin-right: 20px;">
                                    <?php if (empty($block['payment']['items'][$item['value']]['thumb'])) { ?>
                                        <?php echo $item['link']; ?>
                                    <?php } else { ?>
                                        <img src="<?php echo $block['payment']['items'][$item['value']]['thumb']; ?>" />
                                    <?php } ?>
                                </div>
                            </td>
                            <td>
                                <input type="hidden" id="PaymentIcon_<?php echo $item['value'] ?>" name="block[payment][items][<?php echo $item['value'] ?>][image]" value="<?php if (isset($block['payment']['items'][$item['value']]['image'])) echo $block['payment']['items'][$item['value']]['image']; ?>" />
                                <a href="#" class="ImageManager button" data-clear="#PaymentImageManagerClear_<?php echo $item['value'] ?>" data-field="PaymentIcon_<?php echo $item['value'] ?>" data-image="#PaymentIconContainer_<?php echo $item['value'] ?>"><?php echo $__['button_choose_image']; ?></a> &nbsp;
                                <a href="#" class="button" id="PaymentImageManagerClear_<?php echo $item['value'] ?>"><?php echo $__['button_clear']; ?></a>
                            </td>
                        </tr>
                        <?php } ?>
                    </table>
                </div>
            </div>
            <!-- tab: Compression -->
            <div id="tab-module-compression" class="vtabs-content clearafter">
                <table class="form">
                    <tr>
                        <td><?php echo $entry_compress_style ?></td>
                        <td width="10">
                            <div class="kuler-switch-btn">
                                <input type='hidden' name='optimal[style_theme]' value='0' />
                                <input type="checkbox" name="optimal[style_theme]"<?php echo isset($optimal['style_theme']) && $optimal['style_theme'] ? ' checked="checked"' : '' ?>  value="1" rel="style" onchange="return optimal.create(this);">
                                <span class="kuler-switch-btn-holder"></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><?php echo $entry_compress_script ?></td>
                        <td width="10">
                            <div class="kuler-switch-btn">
                                <input type='hidden' name='optimal[script_theme]' value='0' />
                                <input type="checkbox" name="optimal[script_theme]"<?php echo isset($optimal['script_theme']) && $optimal['script_theme'] ? ' checked="checked"' : '' ?>  value="1" rel="script" onchange="return optimal.create(this);">
                                <span class="kuler-switch-btn-holder"></span>
                            </div>
                        </td>
                    </tr>
                </table>				
			</div>
        </form>
	</div>
  </div>
</div>
<?php echo $footer; ?>
<script type="text/javascript">
var g_storeId = <?php echo $selected_store_id; ?>;

var saveUrl = '<?php echo $action; ?>';
saveUrl = saveUrl.replace(new RegExp('&amp;', 'g'), '&');
$('#StoreSelector').on('change', function () {
    window.location = saveUrl + '&store_id=' + $(this).val();
});

var ImageManager = (function () {
    return {
        init: function (selector, context) {
            var self = this;
            self.$el = $(selector, context || document);

            self.$el.bind('click', function (evt) {
                evt.preventDefault();

                self.showDialog($(this).data('field'), $(this).data('image'));
            });

            self.$el.each(function () {
                var $this = $(this);

                $($this.data('clear')).bind('click', function (evt) {
                    evt.preventDefault();

                    $('#' + $this.data('field')).val('');
                    $($this.data('image')).html('');
                });
            });
        },
        showDialog: function (field, image) {
            $('#dialog').remove();

            $('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');

            var val1 = $('#' + field).val();

            $('#dialog').dialog({
                title: 'Image Manager',
                close: function (event, ui) {
                    var val2 = $('#' + field).val();

                    if (val1 != val2) {
                        $('#' + field).val('image/' + val2).trigger('change');

                        if (image !== undefined) {
                            $(image).html($('<img />', {src: '<?php echo $base; ?>image/' + val2}));
                        }
                    }
                },
                bgiframe: false,
                width: 700,
                height: 400,
                resizable: false,
                modal: false
            });
        }
    };
})();

ImageManager.init('.ImageManager');

var ColorPicker = (function () {
    return {
        init: function (selector, context) {
            var CP = this;
            CP.$el = $(selector, context || document);

            CP.$el.each(function () {
                var $cpElement = $(this);
                $(this).ColorPicker({
                    color: CP.$el.data('defaultColor'),
                    onShow: function (colpkr) {
                        // recalculate position of the color picker
                        var pos = $(this).offset();

                        $(colpkr)
                            .css({
                                left: pos.left + 20,
                                top: pos.top + 20
                            })
                            .fadeIn(500);

                        return false;
                    },
                    onHide: function (colpkr) {
                        $(colpkr).fadeOut(500);
                        return false;
                    },
                    onChange: function (hsb, hex, rgb) {
                        $cpElement.find('div').css('backgroundColor', '#' + hex);
                        $($cpElement.data('backgroundColor')).val('#' + hex).trigger('change');
                    }
                });
            });
        }
    };
})();

$(function () {
    ColorPicker.init('.ColorPicker');
});

$(document).ready(function(){
	// Editor for footer information
	CKEDITOR.replaceAll('editor', {
		filebrowserBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
		filebrowserImageBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
		filebrowserFlashBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
		filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
		filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
		filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
	});

    // Attack iframe for get theme all styles / scripts
    $('#iframeCompress').attr('src', '<?php echo $base, '?kuler=clean' ?>');

    $('#tab-seo > a').tabs();
    $('#tab-seo-location a').tabs();
    
	$('#tab-footer a').tabs();
	$('#tab-footer-info-lang a').tabs();
	
	/**
	 * @todo Check Query Param
	 */
    
    $('.vtabs a').click(function() {
        $('#vtab').val($(this).attr('href'));
    }).tabs();
    
    $('.htabs a').click(function() {
        $('#htab').val($(this).attr('href'));
    });
    
    var tab = getURLVar('tab');
	if(typeof (tab) != 'undefined') {
		$('.module-' + tab).click();
	}
    
    <?php if ($vtab) { ?>
        $('.vtabs a[href="<?php echo $vtab ?>"]').click();
    <?php } ?>
        
    <?php if ($htab) { ?>
        $('.htabs a[href="<?php echo $htab ?>"]').click();
    <?php } ?>
});

var g_base = '<?php echo $base; ?>',
    g_optimalScripts = <?php echo json_encode($resources['scripts']); ?>,
    g_optimalStyles = <?php echo json_encode($resources['styles']); ?>;

var optimal = (function() {
    return {
        data: {},
        create: function(obj) {
            var compressionType  = $(obj).attr('rel'),
                items = compressionType == 'script' ? g_optimalScripts : g_optimalStyles;

            if (!items.length) {
                return false;
            }

            for (var i = 0; i < items.length; i++) {
                var itemData = {
                    type: compressionType,
                    value: items[i]
                };

                if (compressionType == 'script') {
                    itemData.encode = 1;
                    itemData.compress = 1;
                }

                optimal.data[items[i]] = itemData;
            }

            var param = {
                't': 'optimalAdd',
                'type': compressionType,
                'name': '',
                'router': '',
                'data': JSON.stringify(optimal.data),
                'store_id': g_storeId
            };

            $.post(window.location.href, param, function(data) {
            }, 'json');
			
			return false;
        }
    }
})();

var sitemap = {
    generate: function() {
        // Get seo current config
        var seo = {};
        $('#form-sitemap-generator input, #form-sitemap-generator select, #form-seo-location input').each(function() {
           var type = $(this).attr('type');
           var name = $(this).attr('name'); 
           var value = $(this).val();
           if(type == 'checkbox') {
               value = $(this).is(':checked');
           }
           if(value === false) {
               value = 0;
           }
           if(value === true) {
               value = 1;
           }

           if(name) {
                name = name.replace(/seo\[/g,'').replace(/\]/g,'');
                seo[name] = value;
            }
        });
        $.post(window.location.href, {'t': 'sitemapGenerate', 'seo': seo}, function(data) {
            var message = 'Sitemap generated successfully !';
            var dialog = $('<div></div>').html(message).dialog({
                modal: true,
                height: 'auto',
                width: 'auto',
                title: 'Sitemap',
                buttons: {
                    Ok: function() {
                        $( this ).dialog( "close" );
                        window.location.href = '<?php echo $moduleLink; ?>&tab=seo';
                    }
                }
            });
            dialog.dialog('open'); return false;
        })
    },
    generatePath: function () {
        var siteMapType = $('#SiteMapType').val(),
            detectFileName = $('#SiteMapDetectFileName').val();

        siteMapType = siteMapType != 'gzip' ? siteMapType : 'gz';
        detectFileName = detectFileName ? detectFileName : 'sitemap.' + siteMapType;

        $('#sitemap_filename').val(detectFileName);
    },
    generateUrl: function () {
        var detectUrl = $('#SiteMapDetectUrl').val();

        detectUrl = detectUrl ? detectUrl : g_base + $('#sitemap_filename').val();

        $('#SiteMapUrl').val(detectUrl);
    }
}

var fontUpdate = function() {
    $.post(window.location.href, {t: 'fontUpdate'}, function(data) {
        var dialog = $('<div></div>').html(data).dialog({
            modal: true,
            height: 'auto',
            width: 'auto',
            title: 'Font update',
            buttons: {
                Ok: function() {
                    $( this ).dialog( "close" );
                    window.location.href = '<?php echo $moduleLink; ?>';
                }
            }
        });
        dialog.dialog('open'); return false;
    })
};

(function () {
    $('#InstallSampleData').on('click', function (evt) {
        evt.preventDefault();

        if (confirm('<?php echo $text_sample_data_confirm_install; ?>')) {
            $('#InstallSampleData')
                .css('display', 'none')
                .after('<span id="InstallSampleDataLoading"><?php echo $text_sample_data_installing; ?></span>')

            $.post(
                $(this).attr('href'),
                {},
                function (response) {
                    var message = response.status ? response.message : 'Error: ' + response.message;

                    $('#InstallSampleDataLoading').text(message);
                    alert(message);
                },
                'json'
            );
        }
    });
})();
</script>